package datasv.framework_datasv;

import po.CourseModelPO;
import resultmessage.FrameworkRM;
import data.datafactory.DatabaseOperator;

public class GetSubModelOfCou {
	public static void main(String[] args) {
		System.out.println(new GetSubModelOfCou()
				.getSubModelOfCou("00101130030"));
	}

	public CourseModelPO getSubModelOfCou(String courseID) {
		return getInSql(courseID);
	}

	private CourseModelPO getInSql(String courseID) {
		DatabaseOperator op = new DatabaseOperator("college");
		if (!op.ifDatabaseExist()) {
			return null;
		}
		if (!op.ifIDExist("course_list", courseID)) {
			return null;
		}
		String m = op.getOneInform(courseID, "course_list", "submodelID");
		if (m == null) {
			return null;
		} else {
			return new CourseModelPO(courseID, m.substring(0, 7), m);
		}

	}
}
